home *** CD-ROM | disk | FTP | other *** search
/ Workbench Add-On / Workbench Add-On - Volume 1.iso / Music / EDIT / PerfectSound / source / monitor.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-08-23  |  1.3 KB  |  66 lines

  1. /* (C) 1986 Anthony J. Wood  */
  2. /* For Perfect Sound digitizer */
  3. /* 7-22-86 */
  4.  
  5.  
  6.  
  7. #include <exec/types.h>
  8. #include <exec/exec.h>
  9. #include <hardware/intbits.h>
  10.  
  11. struct Interrupt *VertB,*old;
  12. short word;
  13.  
  14. main()
  15. {
  16. extern void listen();
  17. UBYTE *direction,*direction2,*data2;
  18. char *base;
  19. unsigned short *aud0vol,*aud0per,*dmaconw,*intena,*aud0dat;
  20. int period;
  21.  
  22. base=0xDEF000;
  23. dmaconw=(unsigned short *)(base+0x096);
  24. aud0vol=(unsigned short *)(base+0x0A8);
  25. aud0per=(unsigned short *)(base+0x0A6);
  26. aud0dat=(unsigned short *)(base+0x0AA);
  27. intena=(unsigned short *)(base+0x9A);
  28.  
  29. printf("Enter a Period: ");
  30. scanf("%d",&period);
  31. printf("\n");
  32.  
  33. data2=0xBFD000;
  34. direction2=0xBFD200;
  35. *direction2=6;
  36. *data2=2;     /* select channel */
  37. direction=0xBFE301;
  38. *direction=0;
  39. *aud0vol=64;
  40. *aud0per=period;
  41.  
  42. VertB=AllocMem(30,MEMF_PUBLIC);
  43. if (VertB==0) {
  44.    printf("not enough memory for interupt server.");
  45.    exit (10);
  46.    }
  47.  
  48. VertB->is_Node.ln_Type=NT_INTERRUPT;
  49. VertB->is_Node.ln_Pri=0;
  50. VertB->is_Node.ln_Name="listener";
  51. VertB->is_Data=&word;    /* not used */
  52. VertB->is_Code=listen;
  53.  
  54.  
  55. if ((old=SetIntVector(INTB_AUD0,VertB))!=0) {
  56.    printf("we just replaced the %s interrupt handler",old->is_Node.ln_Name);
  57.    }
  58.  
  59. *intena=0x8000+128;     /* enable audio interupts */
  60. *aud0dat=0;             /* get interupts started */
  61. xx:
  62. /* printf("%x \n",word); */
  63. goto xx;
  64. }
  65.  
  66.